package master;

import java.awt.GridLayout;
import java.util.LinkedList;
import java.util.List;

import javax.swing.BorderFactory;
import javax.swing.JPanel;

public class RechnerPanel extends JPanel {
	List<Rechner> rechnerList = new LinkedList<Rechner>();

	public List<Rechner> getRechnerList() {
		return rechnerList;
	}

	public void setRechnerList(List<Rechner> rechnerList) {
		this.rechnerList = rechnerList;
	}

	private static final long serialVersionUID = 1L;

	public RechnerPanel(Kasse main) {
		this.setLayout(new GridLayout(3, 5, 15, 15));
		this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		for (int i = 1; i < 15; i++) {
			this.rechnerList.add(new Rechner(i, main));
		}
		for (Rechner rechner : this.rechnerList) {
			this.add(rechner);
		}
	}

	public void stopAll() {
		for (Rechner rechner : rechnerList) {
			if(rechner.isTaken()) {
				rechner.stop(false);
			}
		}
	}

}
